package com.mzj.saas.mservice.aio.controller;

import com.mzj.saas.commons.ResultBean;
import com.mzj.saas.mservice.aio.service.AioService;
import com.mzj.saas.mservice.aio.vo.AioPaymentVO;
import com.mzj.saas.mservice.aio.vo.AuthVO;
import com.mzj.saas.mservice.aio.vo.OrderQueryVO;
import com.mzj.saas.mservice.aio.vo.UserVO;
import com.mzj.saas.mservice.auth.vo.AuthenticationVo;
import com.mzj.saas.mservice.property.vo.RepairsHouse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;
import java.util.Map;

/**
 * 一体机
 */
@Controller
@RequestMapping("/aio")
public class AioController {

    @Autowired
    private AioService aioService;

    /**
     * 验证管理员密码
     *
     * @param pwd
     * @return
     */
    @GetMapping("/verifyPwd")
    @ResponseBody
    public ResultBean<Object> verifyPwd(@RequestParam String pwd) {
        return aioService.verifyPwd(pwd);
    }

    /**
     * 房屋验证人员信息
     *
     * @param vo
     * @return
     */
    @PostMapping("/houseVerifyUser")
    @ResponseBody
    public ResultBean<Object> houseVerifyUser(@RequestBody UserVO vo) {
        return aioService.houseVerifyUser(vo);
    }

    /**
     * 人脸比对
     *
     * @param vo
     * @return
     */
    @PostMapping("/faceCompare")
    @ResponseBody
    public ResultBean<Object> faceCompare(@RequestBody UserVO vo) {
        return aioService.faceCompare(vo);
    }

    /**
     * 房屋列表
     *
     * @param vo
     * @return
     */
    @GetMapping("/houseList")
    @ResponseBody
    public ResultBean<List<RepairsHouse>> houseList(UserVO vo) {
        return aioService.houseList(vo);
    }

    /**
     * 授权身份证或身份证+指纹
     *
     * @param vo
     * @return
     */
    @PostMapping("/lockAuth")
    @ResponseBody
    public ResultBean<Object> lockAuth(@RequestBody AuthVO vo) {
        return aioService.lockAuth(vo);
    }

    /**
     * 验证手机
     *
     * @param vo
     * @return
     */
    @PostMapping("/verifyPhone")
    @ResponseBody
    public ResultBean<Object> verifyPhone(@RequestBody UserVO vo) {
        return aioService.verifyPhone(vo);
    }

    /**
     * 缴费验证人员信息
     *
     * @param vo
     * @return
     */
    @PostMapping("/billVerifyUser")
    @ResponseBody
    public ResultBean<Object> billVerifyUser(@RequestBody UserVO vo) {
        return aioService.billVerifyUser(vo);
    }

    /**
     * 账单列表
     *
     * @param vo
     * @return
     */
    @PostMapping("/billList")
    @ResponseBody
    public ResultBean<Object> billList(@RequestBody UserVO vo) {
        return aioService.billList(vo);
    }

    /**
     * 扫码支付
     *
     * @param vo
     * @return
     */
    @PostMapping("/payment")
    @ResponseBody
    public ResultBean<Map<String, Object>> payment(@RequestBody AioPaymentVO vo) {
        return aioService.payment(vo);
    }

    /**
     * 查询订单
     *
     * @param vo
     * @return
     */
    @PostMapping("/orderQuery")
    @ResponseBody
    public ResultBean<Map<String, Object>> orderQuery(@RequestBody OrderQueryVO vo) {
        return aioService.orderQuery(vo);
    }

    /**
     * 查询设备密码
     *
     * @param number
     * @return
     */
    @GetMapping("/findDevicePwd")
    @ResponseBody
    public ResultBean<Object> findDevicePwd(@RequestParam String number) {
        return aioService.findDevicePwd(number);
    }


    /**
     * 房屋查询
     *
     * @param vo
     * @return
     */
    @PostMapping("/houseList/v2")
    @ResponseBody
    public ResultBean<Object> houseListV2(@RequestBody AuthVO vo) {
        return aioService.houseListV2(vo);
    }

    /**
     * 授权人脸/指纹
     **/
    @PostMapping("/lockFaceAuth")
    @ResponseBody
    public ResultBean<Object> lockFaceAuth(@RequestBody @Valid AuthVO vo) {
        return aioService.lockFaceAuth(vo);
    }


    /**
     * 身份验证
     **/
    @PostMapping("/authVerify")
    @ResponseBody
    public ResultBean<Object> authVerify(@RequestBody AuthenticationVo vo) {
        return aioService.authVerify(vo);
    }

    /**
     * 更新实名信息
     **/
    @PostMapping("/updateAuthInfo")
    @ResponseBody
    public ResultBean<Object> updateAuthInfo(@RequestBody AuthenticationVo vo) {
        return aioService.updateAuthInfo(vo);
    }






}
